/**
 * Created by Administrator on 2017/10/24.
 */
$(function(){
    $(".submit").click(function(){

        var name = $('.username').val();
        var password = $('.password').val();
        if(name==''){
            errorTips('login',$(".username"),"请输入管理员账号");
            return ;
        }
        if(password==''){
            errorTips('login',$(".password"),"请输入登录密码");
            return ;
        }

        /*
         *登录操作
         */
        var uri = $("#login").attr("action");
        var data = $("form[id=login]").serialize();
        ajaxPost(uri, $(".submit"), data, function(r){
            $(".submit").removeAttr("disabled");
            location.href = r.url;
        });
    });
    $(".captcha img").click(function(){
        var ts = Date.parse(new Date())/1000+Math.random();
       /* console.log(ts);*/
        $(".captcha img").attr('src','/captcha?id='+ts);
    });
});